package com.yjhb.android.sbz.fragment.taskmanage;

import android.content.Intent;
import android.view.View;

import com.yjhb.android.sbz.activity.ManagerCenterActivity;
import com.yjhb.android.sbz.adapter.taskmanage.TaskManagerOffAdapter;
import com.yjhb.android.sbz.entity.ManagerTask;
import com.yjhb.android.sbz.enums.TaskState;
import com.yjhb.android.sbz.tool.Tool;

/**
 * 创建者 zx
 * 创建时间 2020/11/20 17:35
 */
public class ViolationFragment extends BaseTaskManageFragment<TaskManagerOffAdapter> {
    private final String TAG = "RepeatFragment";

    @Override
    public CharSequence getTitle() {
        return TaskState.TASK_STATE_VIOLATION.getStateStr();
    }

    @Override
    protected TaskManagerOffAdapter getAdapter() {
        return new TaskManagerOffAdapter(getContext());
    }

    @Override
    protected Integer getState() {
        return TaskState.TASK_STATE_VIOLATION.getState();
    }


    @Override
    public void onItemClick(int index, Object o) {
        super.onItemClick(index, o);
        Intent intent = new Intent(getContext(), ManagerCenterActivity.class);
        intent.putExtra("state", getState());
        intent.putExtra("taskId", dataSet.get(index).getTask().getId());
        startActivity(intent);
    }


    @Override
    public void onViewClick(View view, String msg, int index, Object o) {
        super.onViewClick(view, msg, index, o);
        ManagerTask managerTask = (ManagerTask) o;
        if (msg.equals("check")) {
            Tool.startCheckListActivity(getContext(), managerTask);
        }
    }

    @Override
    protected CharSequence getTips() {
        return "若项目违规下架，官方会在24小时后清算";
    }
}
